<%@ page language="java" import="java.util.*,com.csd.pojo.*,com.csd.helper.*,com.csd.vo.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String type = (String)request.getAttribute("type");

List list = (List)request.getAttribute("list");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>发送消息</title>
<link href="<%=path %>/common/css/rpms_right.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path %>/common/js/check.js"></script>
<script type="text/javascript">
function checkTitle(form){
var flag = true;
var title =  document.getElementsByName('message.title');
flag = checkForm(form);
if(title[0].value.length == 0){
flag = false;
title[0].focus();
}
return flag;
}
</script>
</head>

<body>
    <div class="main">
        <h1>发送消息</h1>
       
        <hr />
        
        <form action="messageSend.action" method="post" onsubmit="return checkTitle(this);">
        <input type="hidden" name="type" value="<%=type %>" />
        
	        <table align="center">
	        	<%if(type!=null && type.length()>0 && list != null && list.size()>0) {%>      
	            <tr>
	                <td class="form_strong">接受者：</td>                 
	                <td>
	                     <select name="message.receiverid">
	                     	<%if(type.equals(IConstant.managerRole)) {%>
	                     		<%List<Manager> ml = (List<Manager>)list; %>
	                     		<%for(Manager i : ml) {%>
	                     		<option value="<%=type+i.getId() %>"><%=i.getName() %>(<%=i.getId() %>)</option>
	                     		<%} %>
	                     	<%} %>
                            <!--
	                     	<%/*if(type.equals(IConstant.teacherRole)) {%>
	                     		<%List<Teacher> trl = (List<Teacher>)list; %>
	                     		<%for(Teacher i : trl) {%>
	                     		<option value="<%=type+i.getId() %>"><%=i.getName() %>(<%=i.getId() %>)</option>
	                     		<%} %>
	                     	<%} */%>
                            -->
                            <%if(type.equals(IConstant.teacherRole)) {%>
	                     		<%List<UserVO> trl = (List<UserVO>)list; %>
	                     		<%for(UserVO i : trl) {%>
	                     		<option value="<%=type+i.getUserID() %>"><%=i.getName() %>(<%=i.getUserID() %>)</option>
	                     		<%} %>
	                     	<%} %>
	                     	<%if(type.equals(IConstant.teamRole)) {%>
	                     		<%List<Team> tml = (List<Team>)list; %>
	                     		<%for(Team i : tml) {%>
	                     		<option value="<%=type+i.getId() %>"><%=i.getName() %>(<%=i.getId() %>)</option>
	                     		<%} %>
	                     	<%} %>
	                     </select>
	                </td>
	            </tr>
	            <%}else{ %>
	            <%String receiverID = (String)request.getParameter("receiverID"); %>
	            	<input type="hidden" name="message.receiverid" value="<%=receiverID %>" />
	            <%} %>
	            <tr>
	                <td class="form_strong">主题：</td>
	                <td colspan="2"><input name="message.title" type="text" size="30" maxlength="20" onblur="checkNotNull(this);" onkeyup="checkNotNull(this)" value="请输入你的标题..."/></td>
	            </tr>
	            <tr>
	                <td class="form_strong" colspan="3"  >内容：</td>
	            </tr>
	            <tr>
	                <td colspan="3" align="center">
	                <textarea rows="15" cols="70"  name="message.content" onblur="checkNotNull(this);" onkeyup="checkNotNull(this);" >你好！这是给你的一封信</textarea>
	                </td>
	            </tr>
	            <tr>
	                <td colspan="3" align="center">
	                	<input type="submit" value="  发送  " />      
	                </td>
	            </tr>
	        </table>

        </form>
    </div>
</body>
</html>
